home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / FredFish PD 316.adf / Life / blit.c < prev    next >
C/C++ Source or Header  |  1990-02-06  |  2KB  |  64 lines

  1. /*
  2.  *   Information gleaned from the Hardware Reference Manual.
  3.  */
  4. #define BLTADD (0xdff040L)
  5. #include "blit.h"
  6. /*
  7.  *   This structure contains everything we need to know.
  8.  *   Do not do a structure copy into this!  Instead, assign
  9.  *   each field.  The last field assigned must be bltsize; that
  10.  *   starts up the blitter.  Also note that all of these are
  11.  *   write only, and you can't read them.
  12.  */
  13. struct bltstruct {
  14.    short con0 ;
  15.    short con1 ;
  16.    short afwm ;
  17.    short alwm ;
  18.    short *csource, *bsource, *asource, *dsource ;
  19.    short bltsize ;
  20.    short dmy1, dmy2, dmy3 ;
  21.    short cmod, bmod, amod, dmod ;
  22.    short dmy4, dmy5, dmy6, dmy7 ;
  23.    short cdat, bdat, adat ;
  24. } ;
  25. /*
  26.  *   This is the main blit routine; it takes a structure and
  27.  *   copies everything to the blitter registers, and starts
  28.  *   the blit.
  29.  */
  30. blit(p)
  31. register struct blitparam *p ;
  32. {
  33.    register struct bltstruct *d ;
  34.  
  35.    d = BLTADD ;
  36. /*
  37.  *   Wait for the blitter to finish whatever it needs to do.
  38.  */
  39.    WaitBlit() ;
  40. /*
  41.  *   Assign the registers.  This code runs very very quickly since
  42.  *   everything is in registers.
  43.  */
  44.    d->con0 = p->con0 ;
  45.    d->con1 = p->con1 ;
  46.    d->afwm = p->fwm ;
  47.    d->alwm = p->lwm ;
  48.    d->asource = p->asource ;
  49.    d->bsource = p->bsource ;
  50.    d->csource = p->csource ;
  51.    d->dsource = p->dsource ;
  52.    d->amod = p->amod ;
  53.    d->bmod = p->bmod ;
  54.    d->cmod = p->cmod ;
  55.    d->dmod = p->dmod ;
  56.    d->adat = p->adat ;
  57.    d->bdat = p->bdat ;
  58.    d->cdat = p->cdat ;
  59. /*
  60.  *   This last assignment starts the blitter.
  61.  */
  62.    d->bltsize = p->bltsize ;
  63. }
  64.